package com.bridgeQQ.client.control.commands
{
	import com.bridgeQQ.client.core.ICommand;
	
	/**
	 * 在 BaseRespond基础上添加新的result, fault处理器
	 * @author User
	 * 
	 */	
	public class BaseWrapper
	{
		private var respond:BaseRespond;
		
		public function BaseWrapper(respond:BaseRespond)
		{
			this.respond = respond;
		}
		
		public function execute():void
		{
			var info:Object = respond.info;
			increment(info, "results", result);
			increment(info, "faults", fault);
			respond.execute();
		}
		
		private function increment(info:Object, field:String, method:Function):void
		{
			var array:Array = info[field];
			if(array == null)
			{
				array = new Array();
				info[field] = array;
			}
			array.push(method);
		}
		
		protected function result(info:Object):void
		{
			
		}
		
		protected function fault(info:Object):void
		{
			
		}

	}
}